package com.pengpeng.sheepfoldmall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.pengpeng.common.valid.AddGroup;
import com.pengpeng.common.valid.ListValue;
import com.pengpeng.common.valid.UpdateGroup;
import com.pengpeng.common.valid.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author pengpeng
 * @email pengpeng@gmail.com
 * @date 2023-08-30 15:43:37
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@Null(message = "不必添加品牌id",groups = {AddGroup.class})
	@NotNull(message = "品牌id不得为空",groups = {UpdateGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不得为空",groups = {AddGroup.class, UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "logo地址不能为空",groups = {AddGroup.class})
	@URL(message = "logo地址必须是一个合法的URL地址",groups = {AddGroup.class, UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListValue(vals = {0,1},groups = {AddGroup.class, UpdateGroup.class, UpdateStatusGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 * @Pattern:regexp属性接收正则表达式
	 */
	@NotBlank(message = "检索首字母不能为空",groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是在a-z或A-Z之间的其中一个",groups = {AddGroup.class, UpdateGroup.class})

	private String firstLetter;
	/**
	 * 排序
	 * @Min校验注解：value表示所接受的最小值
	 */
	@NotNull(message = "排序字段不能为空",groups = {AddGroup.class})
	@Min(value = 0,message = "排序字段必须是大于等于0的整数",groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
